import java.lang.reflect.Field;


public class Variable extends AbstractElement {
	
	public Variable(String value) {
		this.value = value;
		this.type = "Variable";
	}
	
	public Variable() {
		this.type = "Variable";
	}
	
	public Object interpret(RobotActions robot) {
		Class<? extends RobotActions> cls = robot.getClass();
		//object
		Object var_field = null;
		
		Field field;
		try {
			field = cls.getDeclaredField(this.value);
			var_field = field.get(cls);
		} 
		
		catch (Exception e) {
			// TODO Auto-generated catch block
			System.err.println("Variable.interpret: An error ocurred while processing Variable");
			return null;
		}
		
		
		
		//params[i] = var_field;
		return var_field;
	}

}
